package lanou3g.com.Activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.view.Window;
import android.view.WindowManager;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.RelativeLayout;

public class Splash_one_Activity extends Activity {
    private RelativeLayout relativeLayout;
    private final long SPLASH_LENGTH = 4000;

    Handler handler = new Handler();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.activity_one_splash);
        //判断当前SDK版本号，如果是4.4以上，就是支持沉浸式状态栏的
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            //透明状态栏
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
            //透明导航栏
            getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
            relativeLayout = (RelativeLayout) findViewById(R.id.relativeLayout);

            Animation animation = AnimationUtils.loadAnimation(this,R.anim.gradient);

            relativeLayout.setAnimation(animation);
        }
        handler.postDelayed(new Runnable() {
            @Override
            public void run() {
                Intent intent = new Intent(Splash_one_Activity.this, MainActivity.class);
                startActivity(intent);
                overridePendingTransition(R.anim.sign_in, R.anim.start_animation);
                Splash_one_Activity.this.finish();
            }
        }, SPLASH_LENGTH);


    }
}
